<template>
    <div class="contain">
        <el-carousel class="siwpers" height="30rem" arrow="never">
            <el-carousel-item>
                <div class="siwpers-img">
                    <img class="siwper-items" :src="compenyDetail.coverImg" alt="">
                    <div class="toFruit"><span>{{ compenyDetail.abbreviation }}</span><span class="right">→</span></div>
                    <div class="adress"><span class="text2">{{ compenyDetail.address }}</span><img src="../../assets/adress.png" alt="">
                    </div>
                </div>
            </el-carousel-item>
        </el-carousel>
        <div class="center-msg">
            <div class="record-time">录入时间：{{ compenyDetail.createtime }}</div>
            <div class="operate-msg">
                <div class="title">经营信息</div>
                <div class="msg-detail">
                    <div v-for="(item, index) in compenyDetail.content" :key="index" class="detail-box">
                        <div><span class="detail-name">经营品种：</span><span class="detail-name1">{{ item.type }}</span></div>
                        <div><span class="detail-name">上市时间：</span><span class="detail-name1">{{ item.time }}</span></div>
                        <div><span class="detail-name">当前价格：</span><span class="detail-name1">{{ item.price }}</span></div>
                        <div><span class="detail-name">品种图片：(点击查看更多)</span></div>
                        <div class="demo-image__preview">
                            <el-image style="width: 70%;height: 260px;" :src="item.img[0]" :zoom-rate="1.2" :max-scale="7"
                                :min-scale="0.2" :preview-src-list="item.img" :initial-index="4" fit="cover" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="compeny-msg">
            <div class="compeny-title">企业信息</div>
            <div class="div-flex">
                <div class="compeny-img">
                    <img :src="compenyDetail.coverImg" alt="">
                </div>
                <div class="compeny-right">
                    <div class="compeny-name">陕西果业科技有限公司</div>
                    <div class="compeny-detail" v-html="compenyDetail.introduce"></div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { findCompById } from '../../util/api.js'
const router = useRoute()
const compenyDetail = ref({})
console.log(router.query)
const getDetail = async () => {
    let res = await findCompById({ companyId: router.query.id })
    console.log(res)
    if (res.code != 200) return
    compenyDetail.value = res.data
    compenyDetail.value.content = JSON.parse(res.data.content)

    if (compenyDetail.value.content) {
        compenyDetail.value.content.forEach((v) => {
            if (v.img) {
                v.img = v.img.split(';')
            }
        })
    }
    console.log(compenyDetail.value.content)
}
onMounted(() => {
    getDetail()
})
</script>
<style lang="scss" scoped>
.contain {
    width: 100%;

    .siwpers {
        width: 100%;
        height: 480px;

        :deep(.el-carousel__arrow--left) {
            width: 60px;
            height: 60px;
            left: 80px;
            border: 1px solid #52B870;
            font-weight: 500;
            font-size: 16px;
            color: #52B870;
            background: none;
        }

        //右箭头
        :deep(.el-carousel__arrow--right) {
            width: 60px;
            height: 60px;
            right: 80px;
            border: 1px solid #52B870;
            font-weight: 500;
            font-size: 16px;
            color: #52B870;
            background: none;
        }

        .siwpers-img {
            width: 100%;
            height: 480px;
            background-size: 100% 100%;
            position: relative;

            .siwper-items {
                width: 100%;
                height: 100%;
                position: absolute;
                left: 0;
                top: 0;
            }

            .adress {
                width: 130px;
                background: #FFFFFF;
                box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
                border-radius: 20px;
                display: flex;
                justify-content: space-around;
                align-items: center;
                font-size: 14px;
                font-weight: 500;
                color: #323232;
                box-sizing: border-box;
                padding: 5px 10px;
                position: absolute;
                right: 40px;
                bottom: 20px;
                cursor: pointer;
            }

            .adress img {
                width: 14px;
                height: 18px;
            }

            .toFruit {
                width: 126px;
                height: 36px;
                background: #FFFFFF;
                box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
                border-radius: 2px;
                font-size: 14px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #323232;
                line-height: 14px;
                text-align: center;
                position: absolute;
                left: 60px;
                bottom: 30%;
                cursor: pointer;

                .right {
                    color: #52B870;
                    font-size: 14px;
                    line-height: 36px;
                    margin-left: 15px;
                }
            }

            .names {
                display: inline-block;
                font-size: 50px;
                // font-family: AlimamaShuHeiTi-Bold, AlimamaShuHeiTi;
                font-weight: bold;
                color: #52B870;
                line-height: 50px;
                text-shadow: 0px 2px 4px rgba(255, 255, 255, 0.5);
                position: absolute;
                bottom: 60%;
                left: 60px;
            }

        }
    }

    .center-msg {
        width: 100%;
        background-color: #ffffff;
        padding: 54px 224px;
        box-sizing: border-box;

        .record-time {
            height: 28px;
            font-size: 28px;
            font-family: PingFangSC-Semibold, PingFang SC;
            font-weight: 600;
            color: #009966;
            border-bottom: 1px rgba(0, 0, 0, 0.15) solid;
            padding-bottom: 30px;
            margin-bottom: 30px;
        }

        .operate-msg {
            width: 100%;

            .title {
                font-size: 30px;
                font-weight: 400;
                color: #009966;
                margin-bottom: 30px;
            }

            .msg-detail {
                width: 100%;
                display: flex;
                flex-wrap: wrap;

                .detail-box {
                    width: 50%;
                    font-weight: 500;
                    font-size: 22px;
                    color: #1F1F1F;

                    .photo-fruit {
                        width: 70%;
                        height: 260px;
                    }

                    .detail-name {
                        font-weight: 400;
                        color: #A3A3A3;
                        font-size: 22px;
                    }
                }

                .detail-box div {
                    margin-bottom: 15px;
                }
            }
        }
    }

    .compeny-msg {
        width: 100%;
        background-color: #F7F7F7;
        box-sizing: border-box;
        padding: 100px;

        .compeny-title {
            width: 100%;
            text-align: center;
            font-weight: 500;
            color: #121212;
            font-size: 38px;
            margin-bottom: 68px;
        }

        .div-flex {
            width: 100%;
            display: flex;

            .compeny-img {
                width: 800px;
                height: 655px;
                border: 10px solid #ffffff;
                box-sizing: border-box;

                img {
                    width: 100%;
                    height: 100%;
                }
            }

            .compeny-right {
                flex: 1;
                padding-left: 20px;

                .compeny-name {
                    width: 100%;
                    font-size: 22px;
                    font-weight: 500;
                    color: #323232;
                    padding-bottom: 30px;
                    border-bottom: 1px solid #DCDCDC;
                    margin-bottom: 30px;
                }

                .compeny-detail {
                    width: 100%;
                    overflow-y: auto;
                    text-indent: 2em;
                    font-weight: 400;
                    font-size: 22px;
                    color: #666666;
                }
            }
        }
    }
}

.text2 {
    width: 100%;
    font-size: 18px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
    word-break: break-all;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    /* 这里是超出几行省略 */
    overflow: hidden;
}
</style>